#ifndef KRAW3D_H
#define KRAW3D_H

#include "kernel/nrefcounted.h"
#include "kernel/nroot.h"

#include "mathlib/rectangle.h"
#include "mathlib/transform44.h"

//-----------------------------------------------------------------------------

struct Display
{
    Display() : data(0) {}
    int left;
    int top;
    int width;
    int height;
    nString title;

    void *data;
};

//-----------------------------------------------------------------------------

struct Material
{
    Material() : pMaterialData(0) {}
    //...
    //expose access to editable attributes- textures, values, etc.
    void* pMaterialData;
};

//-----------------------------------------------------------------------------

struct Model
{
    Model() : pModelData(0) {}
    Material material;
    transform44 transform;
    void* pModelData;
};

//-----------------------------------------------------------------------------

struct View
{
    View() : data(0) {}

    //viewport
    rectangle viewport;

    //camera
    vector3 eye;
    vector3 at;
    vector3 up;

    //transform
    transform44 transform;

    void* data;
};

//-----------------------------------------------------------------------------

class Kraw3D : public nRoot
{
public:
    Kraw3D();
    ~Kraw3D();
    
    virtual bool Init();
    virtual void Shutdown();
    virtual bool Trigger();
    
    virtual bool OpenDisplay( Display& );
    virtual void CloseDisplay( Display& );
        
    virtual bool LoadView( View& );
    virtual void UnloadView( View& );
    
    virtual bool BeginRender( Display& );
    virtual void EndRender();
    virtual void DrawView( View& );

    //alternative interface for retained rendering
    //virtual void Post( Model& );
    //virtual void Unpost( Model& );

private:

    //list of open displays
    //
};

//-----------------------------------------------------------------------------

#endif
